<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019-06-25
  Time: 8:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        .error{
            color: red;
        }
    </style>
</head>
<body>
    <%
        Cookie[] cookies = request.getCookies();
        for (Cookie cookie:cookies) {
            if (cookie.getName().equals("user")){
                String[] userInfo = cookie.getValue().split("-");
                request.setAttribute("username",userInfo[0]);
                request.setAttribute("password",userInfo[1]);
                break;
            }
        }
    %>
    <form action="${pageContext.request.contextPath}/Login" method="post">
        <div>
            用户名：<input type="text" name="username" autocomplete="off" value="${requestScope.username}">
        </div>
        <div>
            密码：<input type="password" name="password" autocomplete="off" value="${requestScope.password}">
        </div>
        <div>
            <select name="saveTime">
                <option value="no" selected>浏览器进程中</option>
                <option value="day">保存一天</option>
                <option value="week">保存一周</option>
                <option value="month">保存一个月</option>
            </select>
        </div>
        <div class="error">
            ${sessionScope.errorMsg}
        </div>
        <div>
            <input type="submit" value="登录">
        </div>
    </form>
</body>
</html>
